Accessing files in a database stage using a user defined function

ABSTRACT

A file access system for user defined functions (UDFs) can be implemented on a distributed database system. The system can store UDF signatures and interfaces (e.g., classes, sub-classes) that can be called by other users. Upon a UDF being called, one or more interface objects (e.g., InputStream) can be created and requests transferred to a execution node via a network channel. The execution node can implement multiple threads that are authorized and download file data from a staging location (e.g., internal stage, external stage) concurrently.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the benefit of priority to U.S. ProvisionalPatent Application Ser. No. 63/197,803 filed Jun. 7, 2021, the contentsof which are incorporated by reference in their entirety.

TECHNICAL FIELD

Embodiments of the disclosure relate generally to a network-baseddatabase system or a cloud data platform and, more specifically, toimplementing file access to user defined functions of a database.

BACKGROUND

Cloud-based data systems such as data warehouses provide users anability to track and manage large amounts of data. Users can implementfunctions to process the data, such as user defined functions. However,implementing user defined functions on databases is restricted and it isoften not practical to scale use of the user defined functions to enableaccess to a large file (e.g., a one terabyte file) or a large number offiles (e.g., 1,000,000 image files).

BRIEF DESCRIPTION OF THE DRAWINGS

The present disclosure will be understood more fully from the detaileddescription given below and from the accompanying drawings of variousembodiments of the disclosure.

FIG. 1 illustrates an example computing environment that includes anetwork-based data warehouse system in communication with a cloudstorage platform, in accordance with some embodiments of the presentdisclosure.

FIG. 2 is a block diagram illustrating components of a compute servicemanager, in accordance with some embodiments of the present disclosure.

FIG. 3 is a block diagram illustrating components of an executionplatform, in accordance with some embodiments of the present disclosure.

FIG. 4 is a computing environment conceptually illustrating an examplesoftware architecture executing a user defined function (UDF) by aprocess running on a given execution node of the execution platform, inaccordance with some embodiments of the present disclosure.

FIG. 5 shows a data architecture for implementing file access to UDFs ina staging location, in accordance with some embodiments of the presentdisclosure.

FIGS. 6A and 6B show example flow diagrams for implementing file accessfor user defined functions, in accordance with some embodiments of thepresent disclosure.

FIG. 7 illustrates a diagrammatic representation of a machine in theform of a computer system within which a set of instructions may beexecuted for causing the machine to perform any one or more of themethodologies discussed herein, in accordance with some embodiments ofthe present disclosure.

DETAILED DESCRIPTION

Reference will now be made in detail to specific example embodiments forcarrying out the inventive subject matter. Examples of these specificembodiments are illustrated in the accompanying drawings, and specificdetails are set forth in the following description in order to provide athorough understanding of the subject matter. It will be understood thatthese examples are not intended to limit the scope of the claims to theillustrated embodiments. On the contrary, they are intended to coversuch alternatives, modifications, and equivalents as may be includedwithin the scope of the disclosure.

As discussed it can be difficult to implement database user definedfunctions (UDFs) in a scalable approach that can access large files. Tothis end, a function file access system can store one or more UDFsignatures specifying a function name and that take a path to files on astage (e.g., internal storage, external storage). The instructions ofthe UDF can be uploaded and stored on a database system (e.g., for aJava UDF, Java code is stored). The UDF can be shared and executed inthe distributed database between users. For example, a provider accountuser can create a UDF and share access to it to enable a consumeraccount user to call the UDF. When the consumer account user calls theUDF, the system determines that the string corresponds to an UDFinterface (e.g., such as Java InputStream), which has a pointer to thestage file (e.g., where the stage name is specified in the UDFsignature, along with other parameters such as a location in the stream(e.g., “0”, “1000”). An execution node can receive the UDF requests overa network channel and authenticate that the user has access to thefiles, and if transfers credentials to threads of the execution node.The threads of the execution node can then retrieve and cache the filecontents as pages in local memory of the execution node. In some exampleembodiments, the pages pre-cached such that pages that are laterrequested are already stored on the execution node. In some exampleembodiments, the system 230 perform just-in-time retrieval and the pagesare pre-cached but are rather downloaded only upon being requested by agiven UDF (e.g., one or more streams in a given UDF).

FIG. 1 illustrates an example computing environment 100 that includes adatabase system in the example form of a network-based data warehousesystem 102, in accordance with some embodiments of the presentdisclosure. To avoid obscuring the inventive subject matter withunnecessary detail, various functional components that are not germaneto conveying an understanding of the inventive subject matter have beenomitted from FIG. 1 . However, a skilled artisan will readily recognizethat various additional functional components may be included as part ofthe computing environment 100 to facilitate additional functionalitythat is not specifically described herein. In other embodiments, thecomputing environment may comprise another type of network-baseddatabase system or a cloud data platform.

As shown, the computing environment 100 comprises the network-based datawarehouse system 102 in communication with a cloud storage platform 104(e.g., AWS®, Microsoft Azure Blob Storage®, or Google Cloud Storage).The network-based data warehouse system 102 is a network-based systemused for reporting and analysis of integrated data from one or moredisparate sources including one or more storage locations within thecloud storage platform 104. The cloud storage platform 104 comprises aplurality of computing machines and provides on-demand computer systemresources such as data storage and computing power to the network-baseddata warehouse system 102.

The network-based data warehouse system 102 comprises a compute servicemanager 108, an execution platform 110, and one or more metadatadatabases 112. The network-based data warehouse system 102 hosts andprovides data reporting and analysis services to multiple clientaccounts.

The compute service manager 108 coordinates and manages operations ofthe network-based data warehouse system 102. The compute service manager108 also performs query optimization and compilation as well as managingclusters of computing services that provide compute resources (alsoreferred to as “virtual warehouses”). The compute service manager 108can support any number of client accounts such as end users providingdata storage and retrieval requests, system administrators managing thesystems and methods described herein, and other components/devices thatinteract with compute service manager 108.

The compute service manager 108 is also in communication with a clientdevice 114. The client device 114 corresponds to a user of one of themultiple client accounts supported by the network-based data warehousesystem 102. A user may utilize the client device 114 to submit datastorage, retrieval, and analysis requests to the compute service manager108.

The compute service manager 108 is also coupled to one or more metadatadatabases 112 that store metadata pertaining to various functions andaspects associated with the network-based data warehouse system 102 andits users. For example, a metadata database 112 may include a summary ofdata stored in remote data storage systems as well as data availablefrom a local cache. Additionally, a metadata database 112 may includeinformation regarding how data is organized in remote data storagesystems (e.g., the cloud storage platform 104) and the local caches.Information stored by a metadata database 112 allows systems andservices to determine whether a piece of data needs to be accessedwithout loading or accessing the actual data from a storage device.

The compute service manager 108 is further coupled to the executionplatform 110, which provides multiple computing resources that executevarious data storage and data retrieval tasks. The execution platform110 is coupled to storage platform 104 of the cloud storage platform104. The storage platform 104 comprises multiple data storage devices120-1 to 120-N. In some embodiments, the data storage devices 120-1 to120-N are cloud-based storage devices located in one or more geographiclocations. For example, the data storage devices 120-1 to 120-N may bepart of a public cloud infrastructure or a private cloud infrastructure.The data storage devices 120-1 to 120-N may be hard disk drives (HDDs),solid state drives (SSDs), storage clusters, Amazon S3™ storage systems,or any other data storage technology. Additionally, the cloud storageplatform 104 may include distributed file systems (such as HadoopDistributed File Systems (HDFS)), object storage systems, and the like.

The execution platform 110 comprises a plurality of compute nodes. A setof processes on a compute node executes a query plan compiled by thecompute service manager 108. The set of processes can include: a firstprocess to execute the query plan; a second process to monitor anddelete cache files using a least recently used (LRU) policy andimplement an out of memory (00M) error mitigation process; a thirdprocess that extracts health information from process logs and status tosend back to the compute service manager 108; a fourth process toestablish communication with the compute service manager 108 after asystem boot; and a fifth process to handle all communication with acompute cluster for a given job provided by the compute service manager108 and to communicate information back to the compute service manager108 and other compute nodes of the execution platform 110.

In some embodiments, communication links between elements of thecomputing environment 100 are implemented via one or more datacommunication networks. These data communication networks may utilizeany communication protocol and any type of communication medium. In someembodiments, the data communication networks are a combination of two ormore data communication networks (or sub-Networks) coupled to oneanother. In alternate embodiments, these communication links areimplemented using any type of communication medium and any communicationprotocol.

The compute service manager 108, metadata database(s) 112, executionplatform 110, and storage platform 104, are shown in FIG. 1 asindividual discrete components. However, each of the compute servicemanager 108, metadata database(s) 112, execution platform 110, andstorage platform 104 may be implemented as a distributed system (e.g.,distributed across multiple systems/platforms at multiple geographiclocations). Additionally, each of the compute service manager 108,metadata database(s) 112, execution platform 110, and storage platform104 can be scaled up or down (independently of one another) depending onchanges to the requests received and the changing needs of thenetwork-based data warehouse system 102. Thus, in the describedembodiments, the network-based data warehouse system 102 is dynamic andsupports regular changes to meet the current data processing needs.

During typical operation, the network-based data warehouse system 102processes multiple jobs determined by the compute service manager 108.These jobs are scheduled and managed by the compute service manager 108to determine when and how to execute the job. For example, the computeservice manager 108 may divide the job into multiple discrete tasks andmay determine what data is needed to execute each of the multiplediscrete tasks. The compute service manager 108 may assign each of themultiple discrete tasks to one or more nodes of the execution platform110 to process the task. The compute service manager 108 may determinewhat data is needed to process a task and further determine which nodeswithin the execution platform 110 are best suited to process the task.Some nodes may have already cached the data needed to process the taskand, therefore, be a good candidate for processing the task. Metadatastored in a metadata database 112 assists the compute service manager108 in determining which nodes in the execution platform 110 havealready cached at least a portion of the data needed to process thetask. One or more nodes in the execution platform 110 process the taskusing data cached by the nodes and, if necessary, data retrieved fromthe cloud storage platform 104. It is desirable to retrieve as much dataas possible from caches within the execution platform 110 because theretrieval speed is typically much faster than retrieving data from thecloud storage platform 104.

As shown in FIG. 1 , the computing environment 100 separates theexecution platform 110 from the storage platform 104. In thisarrangement, the processing resources and cache resources in theexecution platform 110 operate independently of the data storage devices120-1 to 120-N in the cloud storage platform 104. Thus, the computingresources and cache resources are not restricted to specific datastorage devices 120-1 to 120-N. Instead, all computing resources and allcache resources may retrieve data from, and store data to, any of thedata storage resources in the cloud storage platform 104.

FIG. 2 is a block diagram illustrating components of the compute servicemanager 108, in accordance with some embodiments of the presentdisclosure. As shown in FIG. 2 , the compute service manager 108includes an access manager 202 and a credential management system 204coupled to an access metadata database 206, which is an example of themetadata database(s) 112. Access manager 202 handles authentication andauthorization tasks for the systems described herein. The credentialmanagement system 204 facilitates use of remote stored credentials toaccess external resources such as data resources in a remote storagedevice. As used herein, the remote storage devices may also be referredto as “persistent storage devices” or “shared storage devices.” Forexample, the credential management system 204 may create and maintainremote credential store definitions and credential objects (e.g., in theaccess metadata database 206). A remote credential store definitionidentifies a remote credential store and includes access information toaccess security credentials from the remote credential store. Acredential object identifies one or more security credentials usingnon-sensitive information (e.g., text strings) that are to be retrievedfrom a remote credential store for use in accessing an externalresource. When a request invoking an external resource is received atrun time, the credential management system 204 and access manager 202use information stored in the access metadata database 206 (e.g., acredential object and a credential store definition) to retrievesecurity credentials used to access the external resource from a remotecredential store.

A request processing service 208 manages received data storage requestsand data retrieval requests (e.g., jobs to be performed on databasedata). For example, the request processing service 208 may determine thedata to process a received query (e.g., a data storage request or dataretrieval request). The data may be stored in a cache within theexecution platform 110 or in a data storage device in storage platform104.

A management console service 210 supports access to various systems andprocesses by administrators and other system managers. Additionally, themanagement console service 210 may receive a request to execute a joband monitor the workload on the system.

The compute service manager 108 also includes a job compiler 212, a joboptimizer 214 and a job executor 216. The job compiler 212 parses a jobinto multiple discrete tasks and generates the execution code for eachof the multiple discrete tasks. The job optimizer 214 determines thebest method to execute the multiple discrete tasks based on the datathat needs to be processed. The job optimizer 214 also handles variousdata pruning operations and other data optimization techniques toimprove the speed and efficiency of executing the job. The job executor216 executes the execution code for jobs received from a queue ordetermined by the compute service manager 108.

A job scheduler and coordinator 218 sends received jobs to theappropriate services or systems for compilation, optimization, anddispatch to the execution platform 110. For example, jobs may beprioritized and then processed in that prioritized order. In anembodiment, the job scheduler and coordinator 218 determines a priorityfor internal jobs that are scheduled by the compute service manager 108with other “outside” jobs such as user queries that may be scheduled byother systems in the database but may utilize the same processingresources in the execution platform 110. In some embodiments, the jobscheduler and coordinator 218 identifies or assigns particular nodes inthe execution platform 110 to process particular tasks. A virtualwarehouse manager 220 manages the operation of multiple virtualwarehouses implemented in the execution platform 110. For example, thevirtual warehouse manager 220 may generate query plans for executingreceived queries. The function file access system 230 is configured tomanage file access to files in a stage (e.g., internal or externalstage) using user defined function signatures and UDFs that point to thestage, as discussed in further detail below.

Additionally, the compute service manager 108 includes a configurationand metadata manager 222, which manages the information related to thedata stored in the remote data storage devices and in the local buffers(e.g., the buffers in execution platform 110). The configuration andmetadata manager 222 uses metadata to determine which data files need tobe accessed to retrieve data for processing a particular task or job. Amonitor and workload analyzer 224 oversee processes performed by thecompute service manager 108 and manages the distribution of tasks (e.g.,workload) across the virtual warehouses and execution nodes in theexecution platform 110. The monitor and workload analyzer 224 alsoredistributes tasks, as needed, based on changing workloads throughoutthe network-based data warehouse system 102 and may further redistributetasks based on a user (e.g., “external”) query workload that may also beprocessed by the execution platform 110. The configuration and metadatamanager 222 and the monitor and workload analyzer 224 are coupled to adata storage device 226. Data storage device 226 in FIG. 2 representsany data storage device within the network-based data warehouse system102. For example, data storage device 226 may represent buffers inexecution platform 110, storage devices in storage platform 104, or anyother storage device.

As described in embodiments herein, the compute service manager 108validates all communication from an execution platform (e.g., theexecution platform 110) to validate that the content and context of thatcommunication are consistent with the task(s) known to be assigned tothe execution platform. For example, an instance of the executionplatform executing a query A should not be allowed to request access todata-source D (e.g., data storage device 226) that is not relevant toquery A. Similarly, a given execution node (e.g., execution node 302-1may need to communicate with another execution node (e.g., executionnode 302-2), and should be disallowed from communicating with a thirdexecution node (e.g., execution node 312-1) and any such illicitcommunication can be recorded (e.g., in a log or other location). Also,the information stored on a given execution node is restricted to datarelevant to the current query and any other data is unusable, renderedso by destruction or encryption where the key is unavailable.

FIG. 3 is a block diagram illustrating components of the executionplatform 110, in accordance with some embodiments of the presentdisclosure. As shown in FIG. 3 , the execution platform 110 includesmultiple virtual warehouses, including virtual warehouse 1, virtualwarehouse 2, and virtual warehouse n. Each virtual warehouse includesmultiple execution nodes that each include a data cache and a processor.The virtual warehouses can execute multiple tasks in parallel by usingthe multiple execution nodes. As discussed herein, the executionplatform 110 can add new virtual warehouses and drop existing virtualwarehouses in real-time based on the current processing needs of thesystems and users. This flexibility allows the execution platform 110 toquickly deploy large amounts of computing resources when needed withoutbeing forced to continue paying for those computing resources when theyare no longer needed. All virtual warehouses can access data from anydata storage device (e.g., any storage device in cloud storage platform104).

Although each virtual warehouse shown in FIG. 3 includes three executionnodes, a particular virtual warehouse may include any number ofexecution nodes. Further, the number of execution nodes in a virtualwarehouse is dynamic, such that new execution nodes are created whenadditional demand is present, and existing execution nodes are deletedwhen they are no longer necessary.

Each virtual warehouse is capable of accessing any of the data storagedevices 120-1 to 120-N shown in FIG. 1 . Thus, the virtual warehousesare not necessarily assigned to a specific data storage device 120-1 to120-N and, instead, can access data from any of the data storage devices120-1 to 120-N within the cloud storage platform 104. Similarly, each ofthe execution nodes shown in FIG. 3 can access data from any of the datastorage devices 120-1 to 120-N. In some embodiments, a particularvirtual warehouse or a particular execution node may be temporarilyassigned to a specific data storage device, but the virtual warehouse orexecution node may later access data from any other data storage device.

In the example of FIG. 3 , virtual warehouse 1 includes three executionnodes 302-1, 302-2, and 302-N. Execution node 302-1 includes a cache304-1 and a processor 306-1. Execution node 302-2 includes a cache 304-2and a processor 306-2. Execution node 302-N includes a cache 304-N and aprocessor 306-N. Each execution node 302-1, 302-2, and 302-N isassociated with processing one or more data storage and/or dataretrieval tasks. For example, a virtual warehouse may handle datastorage and data retrieval tasks associated with an internal service,such as a clustering service, a materialized view refresh service, afile compaction service, a storage procedure service, or a file upgradeservice. In other implementations, a particular virtual warehouse mayhandle data storage and data retrieval tasks associated with aparticular data storage system or a particular category of data.

Similar to virtual warehouse 1 discussed above, virtual warehouse 2includes three execution nodes 312-1, 312-2, and 312-N. Execution node312-1 includes a cache 314-1 and a processor 316-1. Execution node 312-2includes a cache 314-2 and a processor 316-2. Execution node 312-Nincludes a cache 314-N and a processor 316-N. Additionally, virtualwarehouse 3 includes three execution nodes 322-1, 322-2, and 322-N.Execution node 322-1 includes a cache 324-1 and a processor 326-1.Execution node 322-2 includes a cache 324-2 and a processor 326-2.Execution node 322-N includes a cache 324-N and a processor 326-N.

In some embodiments, the execution nodes shown in FIG. 3 are statelesswith respect to the data being cached by the execution nodes. Forexample, these execution nodes do not store or otherwise maintain stateinformation about the execution node, or the data being cached by aparticular execution node. Thus, in the event of an execution nodefailure, the failed node can be transparently replaced by another node.Since there is no state information associated with the failed executionnode, the new (replacement) execution node can easily replace the failednode without concern for recreating a particular state.

Although the execution nodes shown in FIG. 3 each includes one datacache and one processor, alternate embodiments may include executionnodes containing any number of processors and any number of caches.Additionally, the caches may vary in size among the different executionnodes. The caches shown in FIG. 3 store, in the local execution node,data that was retrieved from one or more data storage devices in cloudstorage platform 104. Thus, the caches reduce or eliminate thebottleneck problems occurring in platforms that consistently retrievedata from remote storage systems. Instead of repeatedly accessing datafrom the remote storage devices, the systems and methods describedherein access data from the caches in the execution nodes, which issignificantly faster and avoids the bottleneck problem discussed above.In some embodiments, the caches are implemented using high-speed memorydevices that provide fast access to the cached data. Each cache canstore data from any of the storage devices in the cloud storage platform104.

Further, the cache resources and computing resources may vary betweendifferent execution nodes. For example, one execution node may containsignificant computing resources and minimal cache resources, making theexecution node useful for tasks that require significant computingresources. Another execution node may contain significant cacheresources and minimal computing resources, making this execution nodeuseful for tasks that require caching of large amounts of data. Yetanother execution node may contain cache resources providing fasterinput-output operations, useful for tasks that require fast scanning oflarge amounts of data. In some embodiments, the cache resources andcomputing resources associated with a particular execution node aredetermined when the execution node is created, based on the expectedtasks to be performed by the execution node.

Additionally, the cache resources and computing resources associatedwith a particular execution node may change over time based on changingtasks performed by the execution node. For example, an execution nodemay be assigned more processing resources if the tasks performed by theexecution node become more processor-intensive. Similarly, an executionnode may be assigned more cache resources if the tasks performed by theexecution node require a larger cache capacity.

Although virtual warehouses 1, 2, and n are associated with the sameexecution platform 110, the virtual warehouses may be implemented usingmultiple computing systems at multiple geographic locations. Forexample, virtual warehouse 1 can be implemented by a computing system ata first geographic location, while virtual warehouses 2 and n areimplemented by another computing system at a second geographic location.In some embodiments, these different computing systems are cloud-basedcomputing systems maintained by one or more different entities.

Additionally, each virtual warehouse is shown in FIG. 3 as havingmultiple execution nodes. The multiple execution nodes associated witheach virtual warehouse may be implemented using multiple computingsystems at multiple geographic locations. For example, an instance ofvirtual warehouse 1 implements execution nodes 302-1 and 302-2 on onecomputing platform at a geographic location and implements executionnode 302-N at a different computing platform at another geographiclocation. Selecting particular computing systems to implement anexecution node may depend on various factors, such as the level ofresources needed for a particular execution node (e.g., processingresource requirements and cache requirements), the resources availableat particular computing systems, communication capabilities of networkswithin a geographic location or between geographic locations, and whichcomputing systems are already implementing other execution nodes in thevirtual warehouse.

Execution platform 110 is also fault tolerant. For example, if onevirtual warehouse fails, that virtual warehouse is quickly replaced witha different virtual warehouse at a different geographic location.

A particular execution platform 110 may include any number of virtualwarehouses. Additionally, the number of virtual warehouses in aparticular execution platform is dynamic, such that new virtualwarehouses are created when additional processing and/or cachingresources are needed. Similarly, existing virtual warehouses may bedeleted when the resources associated with the virtual warehouse are nolonger necessary.

In some embodiments, the virtual warehouses may operate on the same datain cloud storage platform 104, but each virtual warehouse has its ownexecution nodes with independent processing and caching resources. Thisconfiguration allows requests on different virtual warehouses to beprocessed independently and with no interference between the requests.This independent processing, combined with the ability to dynamicallyadd and remove virtual warehouses, supports the addition of newprocessing capacity for new users without impacting the performanceobserved by the existing users.

FIG. 4 is a computing environment 400 conceptually illustrating anexample software architecture executing a user defined function (UDF) bya process running on a given execution node of the execution platform110, in accordance with some embodiments of the present disclosure.

As illustrated, the execution node 302-1 from the execution platform 110includes an execution node process 410, which in an embodiment isrunning on the processor 306-1 and can also utilize memory from thecache 304-1 (or another memory device or storage). As mentioned herein,a “process” or “computing process” can refer to an instance of acomputer program that is being executed by one or more threads by anexecution node or execution platform.

As mentioned before, the compute service manager 108 validates allcommunication from the execution platform 110 to validate that thecontent and context of that communication are consistent with thetask(s) known to be assigned to the execution platform 110. For example,the execution platform 110 executing a query A is not allowed to requestaccess to a particular data source (e.g., data storage device 226 or anyone of the storage devices in the cloud storage platform 104) that isnot relevant to query A. In an example, the execution node 302-1 mayneed to communicate with a second execution node (e.g., execution node302-2), but the security mechanisms described herein can disallowcommunication with a third execution node (e.g., execution node 312-1).Moreover, any such illicit communication can be recorded (e.g., in a log444 or other location). Further, the information stored on a givenexecution node is restricted to data relevant to the current query andany other data is unusable by destruction or encryption where the key isunavailable.

The execution node process 410 is executing a UDF client 412 in theexample of FIG. 4 . In an embodiment, the UDF client 412 is implementedto support UDFs written in a particular programming language such asJAVA, and the like. In an embodiment, the UDF client 412 is implementedin a different programming language (e.g., C or C++) than the user code430, which can further improve security of the computing environment 400by using a different codebase (e.g., one without the same or fewerpotential security exploits).

User code 430 may be provided as a package e.g., in the form of a JAR(JAVA archive) file which includes code for one or more UDFs. Serverimplementation code 432, in an embodiment, is a JAR file that initiatesa server which is responsible for receiving requests from the executionnode process 410, assigning worker threads to execute user code, andreturning the results, among other types of server tasks.

In an implementation, an operation from a UDF (e.g., JAVA based UDF) canbe performed by a user code runtime 424 executing within a sandboxprocess 420 (e.g., UDF server). In an embodiment, the user code runtime424 is implemented as a virtual machine, such as a JAVA virtual machine(JVM). Since the user code runtime 424 advantageously executes in aseparate process relative to the execution node process 410, there is alower risk of manipulating the execution node process 410. Results ofperforming the operation, among other types of information or messages,can be stored in a log 444 for review and retrieval. In an embodiment,the log 444 can be stored locally in memory at the execution node 302-1,or at a separate location such as the storage platform 104. Moreover,such results can be returned from the user code runtime 424 to the UDFclient 412 utilizing a high-performance protocol (e.g., withoutserialization or deserialization of data, without memory copies;operates on record batches without having to access individual columns,records or cells; utilizes efficient remote procedure call techniquesand network protocol(s) for data transfer) for data transfer (e.g.,distributed datasets) that further provides authentication andencryption of the data transfer. In an embodiment, the UDF client 412uses a data transport mechanism that supports a network transfer ofcolumnar data between the user code runtime 424 (and vice-versa) withthe aforementioned advantages described above.

Security Manager 422, in an example, can prevent completion of anoperation from a given UDF by throwing an exception (e.g., if theoperation is not permitted), or returns (e.g., doing nothing) if theoperation is permitted. In an implementation, the Security Manager 422is implemented as a JAVA security manager object that allowsapplications to implement a security policy such as a security managerpolicy 442, and enables an application to determine, before performing apossibly unsafe or sensitive operation, what the operation is andwhether it is being attempted in a security context that allows theoperation to be performed. The security manager policy 442 can beimplemented as a file with permissions that the user code runtime 424 isgranted. The application (e.g., UDF executed by the user code runtime424) therefore can allow or disallow the operation based at least inpart on the security policy.

Sandbox process 420, in an embodiment, is a sub-process (or separateprocess) from the execution node process 410. A sub-process, in anembodiment, refers to a child process of a given parent process (e.g.,in this example, the execution node process 410). The sandbox process420, in an example, is a program that reduces the risk of securitybreaches by restricting the running environment of untrustedapplications using security mechanisms such as namespaces and securecomputing modes (e.g., using a system call filter to an executingprocess and all its descendants, thus reducing the attack surface of thekernel of a given operating system). Moreover, in an example, thesandbox process 420 is a lightweight process in comparison to theexecution node process 410 and is optimized (e.g., closely coupled tosecurity mechanisms of a given operating system kernel) to process adatabase query in a secure manner within the sandbox environment.

In an embodiment, the sandbox process 420 can utilize a virtual networkconnection in order to communicate with other components within thesubject system. A specific set of rules can be configured for thevirtual network connection with respect to other components of thesubject system. For example, such rules for the virtual networkconnection can be configured for a particular UDF to restrict thelocations (e.g., particular sites on the Internet or components that theUDF can communicate) that are accessible by operations performed by theUDF. Thus, in this example, the UDF can be denied access to particularnetwork locations or sites on the Internet.

The sandbox process 420 can be understood as providing a constrainedcomputing environment for a process (or processes) within the sandbox,where these constrained processes can be controlled and restricted tolimit access to certain computing resources.

Examples of security mechanisms can include the implementation ofnamespaces in which each respective group of processes executing withinthe sandbox environment has access to respective computing resources(e.g., process IDs, hostnames, user IDs, file names, names associatedwith network access, and inter-process communication) that are notaccessible to another group of processes (which may have access to adifferent group of resources not accessible by the former group ofprocesses), other container implementations, and the like. By having thesandbox process 420 execute as a sub-process to the execution nodeprocess 410, in some embodiments, latency in processing a given databasequery can be substantially reduced (e.g., a reduction in latency by afactor of 10× in some instances) in comparison with other techniquesthat may utilize a virtual machine solution by itself.

As further illustrated, the sandbox process 420 can utilize a sandboxpolicy 440 to enforce a given security policy. The sandbox policy 440can be a file with information related to a configuration of the sandboxprocess 420 and details regarding restrictions, if any, and permissionsfor accessing and utilizing system resources. Example restrictions caninclude restrictions to network access, or file system access (e.g.,remapping file system to place files in different locations that may notbe accessible, other files can be mounted in different locations, andthe like). The sandbox process 420 restricts the memory and processor(e.g., CPU) usage of the user code runtime 424, ensuring that otheroperations on the same execution node can execute without running out ofresources.

As mentioned above, the sandbox process 420 is a sub-process (orseparate process) from the execution node process 410, which in practicemeans that the sandbox process 420 resides in a separate memory spacethan the execution node process 410. In an occurrence of a securitybreach in connection with the sandbox process 420 (e.g., by errant ormalicious code from a given UDF), if arbitrary memory is accessed by amalicious actor, the data or information stored by the execution nodeprocess is protected.

Although the above discussion of FIG. 4 describes components that areimplemented using JAVA (e.g., object oriented programming language), itis appreciated that the other programming languages (e.g., interpretedprogramming languages) are supported by the computing environment 400.In an embodiment, PYTHON is supported for implementing and executingUDFs in the computing environment 400. In this example, the user coderuntime 424 can be replaced with a PYTHON interpreter for executingoperations from UDFs (e.g., written in PYTHON) within the sandboxprocess 420.

FIG. 5 shows a data architecture 500 for implementing file access toUDFs in a staging location, according to some example embodiments. TheUDF server 515 (e.g., a child process of the XP process that runs agiven execution node) can manage multiple UDFs 520 (e.g., UDF 1, UDF2,and UDF3), each of which can be defined using a UDF signature ordefinition, discussed in further detail below in FIG. 6 . In accordancewith some example embodiments, each UDF manages one or more streams 525(e.g., Java InputStream), where the number of streams can be specifiedas a parameter of the function or application being specified by theend-user defining the UDF signature(s). For example, if a given UDF is adifference comparing function to compare two different files (e.g., File3 Page 2; and File 3 page 4), then two streams (e.g., Stream1 andStream2) can be created to process the two files (e.g., via thethreads).

The UDF server 515 can open, read, or close requests to the executionnode 510 (e.g., execution node 302-1) via a network interface channel530, such as RPC (e.g., gRPC, Google Remote Procedure Call). In theexecution node 510, multiple threads 535 serve the requests receivedfrom the network interface channel 530 (e.g., to perform concurrentprocessing of requested data). In some example embodiments, each of thethreads goes through a compute service manager access point to accessthe compute service manager 505 (e.g., compute service manager 108) toconfirm the user (e.g., the user calling the UDF) has access rights fora given file handled by the thread. If the thread has access, thecompute service manager 505 passes the credential and access informationto the thread and the thread access the storage platform 104 (e.g.,internal stage, external object storage, external tables, etc.) anddowns the files, which are stored as pages 540 on local memory 545(e.g., disk) of the execution node 510.

FIG. 6A shows a flow diagram of an example method 600 for implementingfile access to user defined functions on a distributed database,according to some example environments. At operation 605, the functionfile access system 230 generates one or more user defined functiondefinitions. For example, an end-user defines a UDF function signatureas follows:

:::::::::::::::::CODE BEGIN::::::::::::::::: public static intFunc_123(InputStream s1, int pos1, InputStream s2, int pos2):::::::::::::::::CODE END:::::::::::::::::

At operation 610, the function fife access system 230 stores one or moreuser defined functions (UDFs) that correspond with the definitions ofoperation 605. An example UDF (e.g., a Java program) that can beuploaded and stored at operation 610 includes:

:::::::::::::::::CODE BEGIN::::::::::::::::: import java.io.*; importcom.berryworks.edireader.json.fromedi. EditoJson; public class Func_123{ public static String Parse(InputStream in)  {   final EditoJsoneditoJson = new EditoJson( );   editoJson.setFormatting(true); //format  editoJson.setAnnotated(false); //annotate  editoJson.setSummarize(false); //summarize   StringWriter sw = newStringWriter( );   try (Reader reader = new BufferedReader(newInputStreamReader(in, “UTF-8”));   Writer writer = newBufferedWriter(sw)) {   editoJson.asJson(reader, writer);   } catch(Exception e) {    throw new RuntimeException(e.getMessage( ));   }  return sw.toString( ); } :::::::::::::::::CODE END:::::::::::::::::

At operation 615, the function file access system 230 receives a callfor one of the UDFs. For example, an end-user having access to call thefunction inputs SQL to call the function:

:::::::::::::::::CODE BEGIN::::::::::::::::: SELECTFunc_123(‘@stage1/path/file1’, 0, ‘@stage2/path/file2’, 1000);:::::::::::::::::CODE END:::::::::::::::::

At operation 620, the function file access system 230 processes therequest for the UDF, as discussed in further detail below with referenceto FIG. 6B. For example, at runtime the system examines the functionsignature, and converts the string to the UDF interface (e.g.,“InputStream”), where the string input argument must contain a validstage file handle (e.g., @stage1). Although InputStream is discussedhere as an example UDF Jaya interface, it is appreciated that the systemlikewise other user defined function interfaces, such as Java File.RandomAccessFile, and others. Further, although Java is discussed hereinas an example language being implemented in the UDF, it is appreciatedthat other languages (e.g., PYTHON) and other function interfaces of agiven language are implemented by the function file access system 230 inaccordance with some example embodiments.

FIG. 6B shows a flow diagram of the example method 650 processingrequests for UDFs, according to some example embodiments.

At operation 655, the UDF server 515 generates requests to a node. Forexample, the UDF server 515 opens one or more streams according to arequested UDF, and the UDF server 515 sends one or more open requestsfrom streams (e.g., InputStreams) to the execution node 510 via thechannel 530.

At operation 660, the execution node 510 receives the requests. Forexample, the threads 535 receive open requests from the channel 530.

At operation 665, the computer service manager 505 authorizes therequests. For example, thread 1 of the threads 535 requestsauthorization for access to a file in the storage platform 104, and thecomputer service manager 505 authorizes the thread's access (e.g., theuser's access) and gives the thread access data (e.g., credentials) toaccess the files in the storage platform 104.

At operation 670, the execution node 510 retrieves file data from thestage. For example, each of the threads 535 concurrently requestsauthorization and credential data and then downloads data from thestorage platform 104 to local memory of the node (e.g., disk 545) forfurther processing according to instructions in the called UDF atoperation 675.

FIG. 7 illustrates a diagrammatic representation of a machine 700 in theform of a computer system within which a set of instructions may beexecuted for causing the machine 700 to perform any one or more of themethodologies discussed herein, according to an example embodiment.Specifically, FIG. 7 shows a diagrammatic representation of the machine700 in the example form of a computer system, within which instructions716 (e.g., software, a program, an application, an applet, an app, orother executable code) for causing the machine 700 to perform any one ormore of the methodologies discussed herein may be executed. For example,the instructions 716 may cause the machine 700 to execute any one ormore operations of the method 600. As another example, the instructions716 may cause the machine 700 to implement portions of the data flowsillustrated in at least FIG. 4 . In this way, the instructions 716transform a general, non-programmed machine into a particular machine700 (e.g., the compute service manager 108 or a node in the executionplatform 110) that is specially configured to carry out any one of thedescribed and illustrated functions in the manner described herein.

In alternative embodiments, the machine 700 operates as a standalonedevice or may be coupled (e.g., networked) to other machines. In anetworked deployment, the machine 700 may operate in the capacity of aserver machine or a client machine in a server-client networkenvironment, or as a peer machine in a peer-to-peer (or distributed)network environment. The machine 700 may comprise, but not be limitedto, a server computer, a client computer, a personal computer (PC), atablet computer, a laptop computer, a netbook, a smart phone, a mobiledevice, a network router, a network switch, a network bridge, or anymachine capable of executing the instructions 716, sequentially orotherwise, that specify actions to be taken by the machine 700. Further,while only a single machine 700 is illustrated, the term “machine” shallalso be taken to include a collection of machines 700 that individuallyor jointly execute the instructions 716 to perform any one or more ofthe methodologies discussed herein.

The machine 700 includes processors 710, memory 730, and input/output(I/O) components 750 configured to communicate with each other such asvia a bus 702. In an example embodiment, the processors 710 (e.g., acentral processing unit (CPU), a reduced instruction set computing(RISC) processor, a complex instruction set computing (CISC) processor,a graphics processing unit (GPU), a digital signal processor (DSP), anapplication-specific integrated circuit (ASIC), a radio-frequencyintegrated circuit (RFIC), another processor, or any suitablecombination thereof) may include, for example, a processor 712 and aprocessor 714 that may execute the instructions 716. The term“processor” is intended to include multi-core processors 710 that maycomprise two or more independent processors (sometimes referred to as“cores”) that may execute instructions 716 contemporaneously. AlthoughFIG. 7 shows multiple processors 710, the machine 700 may include asingle processor with a single core, a single processor with multiplecores (e.g., a multi-core processor), multiple processors with a singlecore, multiple processors with multiple cores, or any combinationthereof.

The memory 730 may include a main memory 732, a static memory 734, and astorage unit 736, all accessible to the processors 710 such as via thebus 702. The main memory 732, the static memory 734, and the storageunit 736 store the instructions 716 embodying any one or more of themethodologies or functions described herein. The instructions 716 mayalso reside, completely or partially, within the main memory 732, withinthe static memory 734, within machine storage medium 738 of the storageunit 736, within at least one of the processors 710 (e.g., within theprocessor's cache memory), or any suitable combination thereof, duringexecution thereof by the machine 700.

The I/O components 750 include components to receive input, provideoutput, produce output, transmit information, exchange information,capture measurements, and so on. The specific I/O components 750 thatare included in a particular machine 700 will depend on the type ofmachine. For example, portable machines such as mobile phones willlikely include a touch input device or other such input mechanisms,while a headless server machine will likely not include such a touchinput device. It will be appreciated that the I/O components 750 mayinclude many other components that are not shown in FIG. 7 . The I/Ocomponents 750 are grouped according to functionality merely forsimplifying the following discussion and the grouping is in no waylimiting. In various example embodiments, the I/O components 750 mayinclude output components 752 and input components 754. The outputcomponents 752 may include visual components (e.g., a display such as aplasma display panel (PDP), a light emitting diode (LED) display, aliquid crystal display (LCD), a projector, or a cathode ray tube (CRT)),acoustic components (e.g., speakers), other signal generators, and soforth. The input components 754 may include alphanumeric inputcomponents (e.g., a keyboard, a touch screen configured to receivealphanumeric input, a photo-optical keyboard, or other alphanumericinput components), point-based input components (e.g., a mouse, atouchpad, a trackball, a joystick, a motion sensor, or another pointinginstrument), tactile input components (e.g., a physical button, a touchscreen that provides location and/or force of touches or touch gestures,or other tactile input components), audio input components (e.g., amicrophone), and the like.

Communication may be implemented using a wide variety of technologies.The I/O components 750 may include communication components 764 operableto couple the machine 700 to a network 780 or devices 770 via a coupling782 and a coupling 772, respectively. For example, the communicationcomponents 764 may include a network interface component or anothersuitable device to interface with the network 780. In further examples,the communication components 764 may include wired communicationcomponents, wireless communication components, cellular communicationcomponents, and other communication components to provide communicationvia other modalities. The devices 770 may be another machine or any of awide variety of peripheral devices (e.g., a peripheral device coupledvia a universal serial bus (USB)). For example, as noted above, themachine 700 may correspond to any one of the compute service manager 108or the execution platform 110, and the devices 770 may include theclient device 114 or any other computing device described herein asbeing in communication with the network-based data warehouse system 102or the cloud storage platform 104.

Executable Instructions and Machine Storage Medium

The various memories (e.g., 730, 732, 734, and/or memory of theprocessor(s) 710 and/or the storage unit 736) may store one or more setsof instructions 716 and data structures (e.g., software) embodying orutilized by any one or more of the methodologies or functions describedherein. These instructions 716, when executed by the processor(s) 710,cause various operations to implement the disclosed embodiments.

As used herein, the terms “machine-storage medium,” “device-storagemedium,” and “computer-storage medium” mean the same thing and may beused interchangeably in this disclosure. The terms refer to a single ormultiple storage devices and/or media (e.g., a centralized ordistributed database, and/or associated caches and servers) that storeexecutable instructions and/or data. The terms shall accordingly betaken to include, but not be limited to, solid-state memories, andoptical and magnetic media, including memory internal or external toprocessors. Specific examples of machine-storage media, computer-storagemedia, and/or device-storage media include non-volatile memory,including by way of example semiconductor memory devices, e.g., erasableprogrammable read-only memory (EPROM), electrically erasableprogrammable read-only memory (EEPROM), field-programmable gate arrays(FPGAs), and flash memory devices; magnetic disks such as internal harddisks and removable disks; magneto-optical disks; and CD-ROM and DVD-ROMdisks. The terms “machine-storage media,” “computer-storage media,” and“device-storage media” specifically exclude carrier waves, modulateddata signals, and other such media, at least some of which are coveredunder the term “signal medium” discussed below.

Transmission Medium

In various example embodiments, one or more portions of the network 780may be an ad hoc network, an intranet, an extranet, a virtual privatenetwork (VPN), a local-area network (LAN), a wireless LAN (WLAN), awide-area network (WAN), a wireless WAN (WWAN), a metropolitan-areanetwork (MAN), the Internet, a portion of the Internet, a portion of thepublic switched telephone network (PSTN), a plain old telephone service(POTS) network, a cellular telephone network, a wireless network, aWi-Fi® network, another type of network, or a combination of two or moresuch networks. For example, the network 780 or a portion of the network780 may include a wireless or cellular network, and the coupling 782 maybe a Code Division Multiple Access (CDMA) connection, a Global Systemfor Mobile communications (GSM) connection, or another type of cellularor wireless coupling. In this example, the coupling 782 may implementany of a variety of types of data transfer technology, such as SingleCarrier Radio Transmission Technology (1×RTT), Evolution-Data Optimized(EVDO) technology, General Packet Radio Service (GPRS) technology,Enhanced Data rates for GSM Evolution (EDGE) technology, thirdGeneration Partnership Project (3GPP) including 3G, fourth generationwireless (4G) networks, Universal Mobile Telecommunications System(UMTS), High-Speed Packet Access (HSPA), Worldwide Interoperability forMicrowave Access (WiMAX), Long Term Evolution (LTE) standard, othersdefined by various standard-setting organizations, other long-rangeprotocols, or other data transfer technology.

The instructions 716 may be transmitted or received over the network 780using a transmission medium via a network interface device (e.g., anetwork interface component included in the communication components764) and utilizing any one of a number of well-known transfer protocols(e.g., hypertext transfer protocol (HTTP)). Similarly, the instructions716 may be transmitted or received using a transmission medium via thecoupling 772 (e.g., a peer-to-peer coupling) to the devices 770. Theterms “transmission medium” and “signal medium” mean the same thing andmay be used interchangeably in this disclosure. The terms “transmissionmedium” and “signal medium” shall be taken to include any intangiblemedium that is capable of storing, encoding, or carrying theinstructions 716 for execution by the machine 700, and include digitalor analog communications signals or other intangible media to facilitatecommunication of such software. Hence, the terms “transmission medium”and “signal medium” shall be taken to include any form of modulated datasignal, carrier wave, and so forth. The term “modulated data signal”means a signal that has one or more of its characteristics set orchanged in such a manner as to encode information in the signal.

Computer-Readable Medium

The terms “machine-readable medium,” “computer-readable medium,” and“device-readable medium” mean the same thing and may be usedinterchangeably in this disclosure. The terms are defined to includeboth machine-storage media and transmission media. Thus, the termsinclude both storage devices/media and carrier waves/modulated datasignals.

The various operations of example methods described herein may beperformed, at least partially, by one or more processors that aretemporarily configured (e.g., by software) or permanently configured toperform the relevant operations. Similarly, the methods described hereinmay be at least partially processor-implemented. For example, at leastsome of the operations of the method 600 may be performed by one or moreprocessors. The performance of certain of the operations may bedistributed among the one or more processors, not only residing within asingle machine, but also deployed across a number of machines. In someexample embodiments, the processor or processors may be located in asingle location (e.g., within a home environment, an office environment,or a server farm), while in other embodiments the processors may bedistributed across a number of locations. In view of the disclosureabove, various examples are set forth below. It should be noted that oneor more features of an example, taken in isolation or combination,should be considered within the disclosure of this application.

Example 1. A method comprising: receiving, in a first computing processof a network database, a plurality of user defined function definitions,each user defined function definition including a user defined functionclass type and function name for a function to be executed in a secondcomputing process; receiving, by the network database, a user definedfunction including code related to at least one operation to beperformed using the user defined function class type, the user definedfunction having a function name that matches one of the plurality ofuser defined function definitions; receiving a request to perform theuser defined function, the request generated by the second computingprocess of the network database; activating one or more objects of theuser defined function class type that correspond to the requested userdefined function; retrieving, by a node of the networked database, filesspecified in the request using a path to a file storage stage thatcorrespond to the one or more activated objects of the user definedclass type; and storing the files on the node.

Example 2. The method of example 1, wherein the file storage stagecorresponds to a external storage device that is external to thenetworked database.

Example 3. The method of any one or more of Examples 1 or 2, wherein theone or more objects of the user defined function class type areactivated on a user defined function server.

Example 4. The method of any one or more of examples 1-3, furthercomprising: transmitting requests from the one or more objects to aplurality of threads of the node using a network channel within thenode.

Example 5. The method of any one or more of Examples 1-4, wherein thenetwork channel is a remote procedure call (RPC) channel.

Example 6. The method of any one or more of Examples 1-5, furthercomprising: determining, by the network database, each thread isauthorized to access one of the files based on a user of the secondcomputing process being previously granted access to the each of the oneof the files by another user of the first computing process.

Example 7. The method of any one or more of Examples 1-6, furthercomprising: processing, by the second computing process, the filesaccording to the at least one operation.

Example 8. A system comprising: one or more processors of a machine; anda memory storing instructions that, when executed by the one or moreprocessors, cause the machine to perform operations comprising any oneor more of the methods of the Examples 1-7.

Example 9. A machine storage medium embodying instructions that, whenexecuted by a machine, cause the machine to perform operationscomprising any one or more of the methods of the Examples 1-7.

Although the embodiments of the present disclosure have been describedwith reference to specific example embodiments, it will be evident thatvarious modifications and changes may be made to these embodimentswithout departing from the broader scope of the inventive subjectmatter. Accordingly, the specification and drawings are to be regardedin an illustrative rather than a restrictive sense. The accompanyingdrawings that form a part hereof show, by way of illustration, and notof limitation, specific embodiments in which the subject matter may bepracticed. The embodiments illustrated are described in sufficientdetail to enable those skilled in the art to practice the teachingsdisclosed herein. Other embodiments may be used and derived therefrom,such that structural and logical substitutions and changes may be madewithout departing from the scope of this disclosure. This DetailedDescription, therefore, is not to be taken in a limiting sense, and thescope of various embodiments is defined only by the appended claims,along with the full range of equivalents to which such claims areentitled.

Such embodiments of the inventive subject matter may be referred toherein, individually and/or collectively, by the term “invention” merelyfor convenience and without intending to voluntarily limit the scope ofthis application to any single invention or inventive concept if morethan one is in fact disclosed. Thus, although specific embodiments havebeen illustrated and described herein, it should be appreciated that anyarrangement calculated to achieve the same purpose may be substitutedfor the specific embodiments shown. This disclosure is intended to coverany and all adaptations or variations of various embodiments.Combinations of the above embodiments, and other embodiments notspecifically described herein, will be apparent, to those of skill inthe art, upon reviewing the above description.

In this document, the terms “a” or “an” are used, as is common in patentdocuments, to include one or more than one, independent of any otherinstances or usages of “at least one” or “one or more.” In thisdocument, the term “or” is used to refer to a nonexclusive or, such that“A or B” includes “A but not B,” “B but not A,” and “A and B,” unlessotherwise indicated. In the appended claims, the terms “including” and“in which” are used as the plain-English equivalents of the respectiveterms “comprising” and “wherein.” Also, in the following claims, theterms “including” and “comprising” are open-ended; that is, a system,device, article, or process that includes elements in addition to thoselisted after such a term in a claim is still deemed to fall within thescope of that claim.

What is claimed is:
 1. A method comprising: receiving, in a firstdatabase of a network database system, a plurality of database functiondefinitions, a database function definition of the plurality of databasefunction definitions, the database function definition specifying one ormore input data streams and including a database function class type anda function name for a function to be executed in a second database ofthe network database system; receiving, by the network database system,a database function including code related to at least one operation tobe performed using the database function class type and the one or moreinput data streams specified by the database function definition, thedatabase function having a function name that matches one of theplurality of database function definitions; receiving a request toperform the database function, the request generated by the seconddatabase of the network database system; activating, on a user definedfunction server, one or more objects of the database function class typethat correspond to the requested database function, the one or moreobjects comprising one or more user defined function database objects;retrieving, by the network database system, files specified in therequest using the one or more input data streams and a path to a filestorage stage that corresponds to the one or more activated objects ofthe database function class type; and storing the files on the networkdatabase system.
 2. The method of claim 1, further comprising:generating, by a function server of the second database, results data byapplying a query on the files stored on a node of the network databasesystem, wherein the files are provided to the function server over anetwork channel in the node.
 3. The method of claim 2, wherein thenetwork channel is a remote procedure call (RPC) channel.
 4. The methodof claim 1, wherein the file storage stage corresponds to a externalstorage device that is external to the network database system.
 5. Themethod of claim 1, further comprising: determining, by the networkdatabase system, each thread is authorized to access one of the filesbased on a user of the second database being previously granted sharedaccess to the each of the one of the files by the first database.
 6. Themethod of claim 1, wherein the database function is a database codefile, and the method further comprises: processing, by the seconddatabase, the files according to one or more instructions in the code ofthe database code file.
 7. The method of claim 6, wherein the databasecode file is a Java Application Programming (JAR) file.
 8. The method ofclaim 1, wherein the one or more objects are Java Virtual Machines(JVMs).
 9. The method of claim 1, wherein the one or more objects areactivated using a database query generated by the second database. 10.The method of claim 9, wherein the database query comprises a selectstatement that includes the function name of the database function. 11.The method of claim 10, wherein the each of the plurality of databasefunction definitions is a shareable function that is generated on thenetwork database system by the first database, wherein the firstdatabase shares access to the shareable function for execution on thesecond database.
 12. The method of claim 1, wherein the databasefunction class type is an input stream class.
 13. A system comprising:one or more processors of a machine; and at least one memory storinginstructions that, when executed by the one or more processors, causethe machine to perform operations comprising: receiving, in a firstdatabase of a network database system, a plurality of database functiondefinitions, a database function definition of the plurality of databasefunction definitions, the database function definition specifying one ormore input data streams and including a database function class type anda function name for a function to be executed in a second database ofthe network database system; receiving, by the network database system,a database function including code related to at least one operation tobe performed using the database function class type and the one or moreinput data streams specified by the database function definition, thedatabase function having a function name that matches one of theplurality of database function definitions; receiving a request toperform the database function, the request generated by the seconddatabase of the network database system; activating, on a user definedfunction server, one or more objects of the database function class typethat correspond to the requested database function, the one or moreobjects comprising one or more user defined function database objects;retrieving, by the network database system, files specified in therequest using the one or more input data streams and a path to a filestorage stage that corresponds to the one or more activated objects ofthe database function class type; and storing the files on the networkdatabase system.
 14. The system of claim 13, further comprising:generating, by a function server of the second database, results data byapplying a query on the files stored on a node of the network databasesystem, wherein the files are provided to the function server over anetwork channel in the node.
 15. The system of claim 14, wherein thenetwork channel is a remote procedure call (RPC) channel.
 16. The systemof claim 13, wherein the file storage stage corresponds to a externalstorage device that is external to the network database system.
 17. Thesystem of claim 13, further comprising: determining, by the networkdatabase system, that each thread is authorized to access one of thefiles based on a user of the second database being previously grantedshared access to the each of the one of the files by the first database.18. The system of claim 13, wherein the database function is a databasecode file, and the system further comprises: processing, by the seconddatabase, the files according to one or more instructions in the code ofthe database code file.
 19. The system of claim 18, wherein the databasecode file is a Java Application Programming (JAR) file.
 20. The systemof claim 13, wherein the one or more objects are Java Virtual Machines(JVMs).
 21. The system of claim 13, wherein the one or more objects areactivated using a database query generated by the second database. 22.The system of claim 21, wherein the database query comprises a selectstatement that includes the function name of the database function. 23.The system of claim 22, wherein the each of the plurality of databasefunction definitions is a shareable function that is generated on thenetwork database system by the first database, wherein the firstdatabase shares access to the shareable function for execution on thesecond database.
 24. The system of claim 13, wherein the databasefunction class type is an input stream class.
 25. A machine storagemedium embodying instructions that, when executed by a machine, causethe machine to perform operations comprising: receiving, in a firstdatabase of a network database system, a plurality of database functiondefinitions, a database function definition of the plurality of databasefunction definitions, the database function definition specifying one ormore input data streams and including a database function class type anda function name for a function to be executed in a second database ofthe network database system; receiving, by the network database system,a database function including code related to at least one operation tobe performed using the database function class type and the one or moreinput data streams specified by the database function definition, thedatabase function having a function name that matches one of theplurality of database function definitions; receiving a request toperform the database function, the request generated by the seconddatabase of the network database system; activating, on a user definedfunction server, one or more objects of the database function class typethat correspond to the requested database function, the one or moreobjects comprising one or more user defined function database objects;retrieving, by the network database system, files specified in therequest using the one or more input data streams and a path to a filestorage stage that corresponds to the one or more activated objects ofthe database function class type; and storing the files on the networkdatabase system.
 26. The machine storage medium of claim 25, furthercomprising: generating, by a function server of the second database,results data by applying a query on the files stored on a node of thenetwork database system, wherein the files are provided to the functionserver over a network channel in the node.
 27. The machine storagemedium of claim 26, wherein the network channel is a remote procedurecall (RPC) channel.
 28. The machine storage medium of claim 25, whereinthe file storage stage corresponds to an external storage device that isexternal to the network database system.
 29. The machine storage mediumof claim 25, the operations further comprising: determining that eachthread is authorized to access one of the files based on a user of thesecond database being previously granted shared access to the each ofthe one of the files by the first database.
 30. The machine storagemedium of claim 25, wherein the database function is in a database codefile, and wherein the second database processes the files according toone or more instructions in the code of the database code file.